package com.ohc.leetcode.字符串.repect;


/**
 * 2022年5月9日14:58:56
 */
public class 反转字符串01 {


    public static void main(String[] args) {
        String str = "helloworld";
        int left = 0;
        char temp;
        char[] chars = str.toCharArray();
        int right = str.length() - 1;
        while (left < right) {
            temp = chars[left];
            chars[left] = chars[right];
            chars[right] = temp;
            left++;
            right--;
        }
        String s = String.valueOf(chars);
        System.out.println("s = " + s);
    }
}
